/**
 * 
 */
package net.sf.rose.common;

import net.sf.rose.util.MessageUtils;

/**
 * @author fgg047
 * 
 */
public class NodeBean {

	private String id = null;

	private Object bean = null;

	/**
	 * 
	 */
	public NodeBean(Object sourceBean) {
		this.bean = sourceBean;
	}

	/**
	 * 
	 */
	public String getID() {
		return id;
	}

	/**
	 * 
	 */
	public void setID(String id) {
		this.id = id;
	}

	/**
	 * 
	 */
	public Object getBean() {
		return bean;
	}

	/**
	 * 
	 */
	public void setBean(Object bean) {
		this.bean = bean;
	}

	/**
	 * 
	 */
	public String toString() {
		return MessageUtils.get(bean.toString());
	}

	/**
	 * 
	 */
	public boolean equals(Object obj) {
		if (obj instanceof NodeBean) {
			NodeBean node = (NodeBean) obj;
			if (id != null && node.getID() != null && id.equals(node.getID())) {
				return true;
			} else {
				return bean.equals(node.getBean()) ? true : false;
			}
		}
		return false;
	}

}
